﻿// JScript File

//function to restrict the text input in a text area
function setMaxLength(obj, maxLength){

if (obj.value.length>maxLength)
obj.value=obj.value.substring(0,maxLength)
}

function ShowControl(ctrl, bool)
{
    var obj = document.getElementById(ctrl);
    if(bool==true)
        obj.style.display = 'block';
    else
        obj.style.display = 'none';
        
    return false;
}

function setStyle(objId, style, value) {
    document.getElementById(objId).style[style] = value;
}

function tbGotFocus(obj, defaultText) {

    if (obj.value == defaultText) {
        obj.value = '';
    }
}
function tbLostFocus(obj, defaultText) {

    if (obj.value == '') {
        obj.value = defaultText;
    }
}

function PopupCenter(pageURL, title, w, h) {
    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);

    if (pageURL.indexOf('?')>-1)
        var targetWin = window.open(pageURL + '&w=' + w + '&h=' + h, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
    else
        var targetWin = window.open(pageURL + '?w=' + w + '&h=' + h, title, ', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
    
    return false;
}

function PopupCenterWithScroll(pageURL, title, w, h) {
    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);

    if (pageURL.indexOf('?') > -1)
        var targetWin = window.open(pageURL + '&w=' + w + '&h=' + h, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=1, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
    else
        var targetWin = window.open(pageURL + '?w=' + w + '&h=' + h, title, ', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=1, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);

    return false;
} 
 
